Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ntuple(::Integer, ::Function) #11486

Merged
merged 2 commits into from
May 31, 2015
Merged

Deprecate ntuple(::Integer, ::Function) #11486

merged 2 commits into from
May 31, 2015

Conversation

timholy
Copy link
Member

@timholy timholy commented May 29, 2015

I think we should do this now, because someday we may want to duck-type the function argument (FastAnonymous or otherwise). But we need one release cycle of deprecation first.

More controversially, I also added an inferrable variant of ntuple. It's based on Val and @generated functions, the latter of which is the likely source of controversy. I separated this into a separate commit so that it can be easily dropped, if necessary.

timholy added 2 commits May 29, 2015 10:19
Some day we will want to duck-type the Function argument to ntuple,
but we need one release cycle with a deprecation warning before we
can do that. So let's do the deprecation now.
It's inferrable with Functors and FastAnonymous, but not (currently)
generic functions.
@timholy
Copy link
Member Author

timholy commented May 31, 2015

Since little controversy seems to have been stirred up, and approval for the general idea was given in #9961, merging.

timholy added a commit that referenced this pull request May 31, 2015
Deprecate ntuple(::Integer, ::Function)
@timholy timholy merged commit 7fa2cf1 into master May 31, 2015
@timholy timholy deleted the teh/ntuple_argorder branch May 31, 2015 12:10
@simonster simonster mentioned this pull request May 31, 2015
5 tasks
@rShekhtman
Copy link

Since ntuple got deprecated, I think someone should modify the ndgrid.jl file in the examples directory.
The following is the current output:

julia> include("ndgrid.jl")
meshgrid (generic function with 3 methods)

julia> a = ndgrid(1:3,1:4,1:2);
WARNING: ntuple(n::Integer,f::Function) is deprecated, use ntuple(f,n) instead.
 in depwarn at ./deprecated.jl:62
 in ntuple at deprecated.jl:49
 in ndgrid at /home/roman/julia/julia/examples/ndgrid.jl:21
while loading no file, in expression starting on line 0

julia> versioninfo()
Julia Version 0.4.0-dev+5203
Commit 7e4f148* (2015-06-04 17:16 UTC)

@timholy
Copy link
Member Author

timholy commented Jun 4, 2015

Fixed in 85e3fe0. If you noticed this because you use ndgrid, consider contributing a test for it (in test/examples.jl), as otherwise problems like this will go unnoticed by developers.

@tkelman
Copy link
Contributor

tkelman commented Jun 4, 2015

Hm. Why didn't

include(joinpath(dir, "ndgrid.jl"))
show this warning?

@rShekhtman
Copy link

@tkelman In the examples.jl, the call to ndgrid was 2 AbstractVectors. The warning would only appear if the call has 3 or more of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants